package com.bms.cfcmms.controller.authority;

import com.bms.cfcmms.controller.BaseController;
import com.bms.cfcmms.model.system.authority.RoleGroup;
import com.bms.cfcmms.service.authority.RoleGroupService;
import com.bms.cfcmms.util.ActionResult;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by carl on 2016/8/4.
 */
@RestController
@RequestMapping("/rolegroup")
public class RoleGroupController extends BaseController {

    @Resource
    private RoleGroupService roleGroupService;


    @RequestMapping(value = "/add.do")
    @Transactional(propagation = Propagation.REQUIRED)
    public ActionResult saveRoleGroup(String title, String remark) {

        ActionResult result = new ActionResult();
        RoleGroup roleGroup = new RoleGroup();
        roleGroup.setTitle(title);
        roleGroup.setRemark(remark);

        Integer total = roleGroupService.saveRoleGroup(roleGroup);
        result.setSuccess(true);
        result.setTotal(total);
        return result;
    }
}
